/*package com.hy.mydesktop.client.component.factory;

import java.util.ArrayList;
import java.util.List;

import com.extjs.gxt.ui.client.data.BaseListLoadResult;
import com.extjs.gxt.ui.client.data.BaseListLoader;
import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
import com.extjs.gxt.ui.client.data.DataProxy;
import com.extjs.gxt.ui.client.data.ListLoader;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.RpcProxy;
import com.extjs.gxt.ui.client.data.TreeLoader;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.hy.mydesktop.client.component.meta.BaseGridModelEnum;
import com.hy.mydesktop.client.component.meta.EditableGridModelEnum;
import com.hy.mydesktop.client.component.meta.GxtComponentMetaModel;
import com.hy.mydesktop.shared.persistence.domain.gxt.GxtComponentMetaNodeModel;


*//**
 * 
 * <ul>
 * <li>开发作者：花宏宇</li>
 * <li>设计日期：2010-8-31；时间：下午02:26:17</li>
 * <li>类型名称：BaseGridFactory</li>
 * <li>设计目的：此工厂，创建BaseGrid(并且，在内部调用GridColumnConfigFactory，创建ColumnConfig列表)</li>
 * </ul>
 * <ul>
 * <b>修订编号：</b>
 * <li>修订日期：</li>
 * <li>修订作者：</li>
 * <li>修订原因：</li>
 * <li>修订内容：</li>
 * </ul>
 *//*
public class BaseGridFactory {
	private static List<ColumnConfig> configs;
	private static GridCellRenderer<ModelData> ageRender;

	public static Grid<ModelData> createBaseGrid(
			GxtComponentMetaNodeModel gxtComponentMetaNodeModel) {

		return configureBaseGrid(gxtComponentMetaNodeModel);

	}

	
	private static Grid<ModelData> configureBaseGrid(
			final GxtComponentMetaNodeModel gxtComponentMetaNodeModel) {
		//TODO createDefaultBaseGrid()?
		Grid<ModelData> baseGrid = new Grid<ModelData>(null, null);
		//TODO 如何根据ColumnModel和ListStore创建表格？？？？
		*//**
		 * 怎么做到ColumnModel和ListStore的同步，
		 * ListStore如何来的？用Loader？
		 *//*
		if (gxtComponentMetaNodeModel.get(BaseGridModelEnum.COLUMNMODEL.name()
				.toLowerCase()) != null) {
			
			//获得list 
			List<ColumnConfig> list = null;//GridColumnConfigFactory.createColumnConfigList(gxtComponentMetaNodeModel);
			ColumnModel columnModel = new ColumnModel(list);
			
			//进一步判断表格中是否有数据，即LISTSTORE是否为空
			ListStore<ModelData> listStore = null;
			listStore = new ListStore<ModelData>();
			//数据加载方式 1：
			if (gxtComponentMetaNodeModel.get(BaseGridModelEnum.LISTSTORE.name().toLowerCase()) != null) {
					
				List<ModelData> modelDataList = (List<ModelData>)gxtComponentMetaNodeModel.get(BaseGridModelEnum.MODELDATA_LIST.name().toLowerCase());
				listStore.add(modelDataList);
				//baseGrid.reconfigure(listStore, columnModel);
				baseGrid.reconfigure(listStore, columnModel);
				
			} 
			
			
			//数据加载方式 2：
			
			if (gxtComponentMetaNodeModel.get(BaseGridModelEnum.LISTSTORE.name().toLowerCase()) != null) {
					
				RpcProxy<List<ModelData>> proxy = new RpcProxy<List<ModelData>>() {
			@Override
			protected void load(Object loadConfig,
					AsyncCallback<List<ModelData>> callback) {
				//TODO 如何用数据代理处理数据
				if(gxtComponentMetaNodeModel.get(BaseGridModelEnum.PROXY.name().toLowerCase()) != null){
					//coding.........................
					List<ModelData> list = new ArrayList<ModelData>();
					
				}
			}
		};
//		ListLoader<BaseListLoadResult<ModelData>> listLoader = new BaseListLoader<BaseListLoadResult<ModelData>>(proxy);
		ListLoader<BasePagingLoadResult<ModelData>> listLoader = new BaseListLoader<BasePagingLoadResult<ModelData>>(proxy);
		
//		listStore = new ListStore<ModelData>(listLoader);
 	baseGrid.reconfigure(listStore, columnModel);
				
			}  
				
			

		} if (gxtComponentMetaNodeModel.get(BaseGridModelEnum.HEIGHT.name()
				.toLowerCase()) != null) {
			Integer height = (Integer) gxtComponentMetaNodeModel
					.get(BaseGridModelEnum.HEIGHT.name().toLowerCase());
			baseGrid.setHeight((int) height);

		} if (gxtComponentMetaNodeModel.get(BaseGridModelEnum.WIDTH.name()
				.toLowerCase()) != null) {
			Integer width = (Integer) gxtComponentMetaNodeModel
					.get(BaseGridModelEnum.WIDTH.name().toLowerCase());
			baseGrid.setWidth((int) width);

		}  if (gxtComponentMetaNodeModel
				.get(BaseGridModelEnum.ENABLECOLUMNRESIZE.name()
						.toLowerCase()) != null) {
			Boolean enableColumnResize = (Boolean) gxtComponentMetaNodeModel
					.get(BaseGridModelEnum.ENABLECOLUMNRESIZE.name()
							.toLowerCase());
			baseGrid.setEnableColumnResize(enableColumnResize);

		}  if (gxtComponentMetaNodeModel
				.get(BaseGridModelEnum.MINCOLUMNWIDTH.name().toLowerCase()) != null) {
			Integer minColumnWidth = (Integer) gxtComponentMetaNodeModel
					.get(BaseGridModelEnum.MINCOLUMNWIDTH.name()
							.toLowerCase());
			baseGrid.setMinColumnWidth(minColumnWidth);

		}  if (gxtComponentMetaNodeModel.get(BaseGridModelEnum.NUMBER
				.name().toLowerCase()) != null) {
			Integer number = (Integer) gxtComponentMetaNodeModel
					.get(BaseGridModelEnum.NUMBER.name().toLowerCase());
			getField(configs, ageRender, number);

		}  {

		}

		return baseGrid;
	}

	private static Grid<ModelData> createDefaultBaseGrid() {

		RpcProxy<List<ModelData>> proxy = new RpcProxy<List<ModelData>>() {
			@Override
			protected void load(Object loadConfig,
					AsyncCallback<List<ModelData>> callback) {
			//	DataServiceAsync service = GWT.create(DataService.class);
			//	service.readData(callback);
			}
		};

		ListLoader<BaseListLoadResult<ModelData>> loader = new BaseListLoader<BaseListLoadResult<ModelData>>(
				proxy);
		ListStore<ModelData> employeeStore = new ListStore<ModelData>(loader);
		ageRender = new GridCellRenderer<ModelData>() {
			@Override
			public Object render(ModelData model, String property,
					com.extjs.gxt.ui.client.widget.grid.ColumnData config,
					int rowIndex, int colIndex, ListStore<ModelData> store,
					Grid<ModelData> grid) {
				return null;
			}
		};

		configs = new ArrayList<ColumnConfig>();

		ColumnModel cm = new ColumnModel(configs);

		EditorGrid<ModelData> editorGrid = new EditorGrid<ModelData>(
				employeeStore, cm);
		return editorGrid;
	}

	private static List<ColumnConfig> getField(List<ColumnConfig> configs,
			GridCellRenderer<ModelData> ageRender, int number) {
		for (int i = 0; i < number; i++) {
			ColumnConfig name = new ColumnConfig();
			name.setId("");
			name.setHeader("");
			name.setWidth(100);
			name.setRenderer(ageRender);
			configs.add(name);
		}
		return configs;
	}
}*/
